// 模拟跨越点数据
export const mockCrossingPoints = [
  {
    id: 'crossing-1',
    projectId: 'project-1', // 修正为 projectId
    name: '500kV输电线路跨越高速公路',
    code: 'CP_001', // 补充 code 字段
    crossingType: 'highwayExpressway', // 修正为驼峰式
    crossingObject: '高速公路', // 补充字段
    towerLeft: {
      towerNumber: 'N01',
      towerType: '耐张塔',
      towerHeight: 90,
      towerLeftDistance: 50
    },
    towerRight: {
      towerNumber: 'N02',
      towerType: '耐张塔',
      towerHeight: 92,
      towerLeftDistance: 150
    },
    spanLength: 250,
    crossingHeight: 200,
    requiresPowerOutage: false,
    created_date: '2023-10-15T08:30:00Z',
    updatedDate: '2023-10-20T14:20:00Z'
  }
];

// 模拟接口方法
export const CrossingPointMock = {
  get: async (id) => {
    await new Promise(resolve => setTimeout(resolve, 300));
    const point = mockCrossingPoints.find(item => item.id === id);
    if (!point) {
      throw new Error('未找到指定的跨越点');
    }
    return point;
  },
  list: async () => {
    await new Promise(resolve => setTimeout(resolve, 300));
    return mockCrossingPoints;
  },
  update: async (id, data) => {
    await new Promise(resolve => setTimeout(resolve, 300));
    const index = mockCrossingPoints.findIndex(item => item.id === id);
    if (index === -1) {
      throw new Error('更新失败，未找到跨越点');
    }
    mockCrossingPoints[index] = { ...mockCrossingPoints[index], ...data };
    return mockCrossingPoints[index];
  }
};